#include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>
#include <math.h>
#include <algorithm>
using namespace std;

string countAndSay(int n) {
    string last;
    string now="1";
    int num=1,size;
    for(short i=1;i<n;i++){
        last = now;
        size=last.size();
        now.clear();
        for(short j=0;j<size;j++){
            if((j<size-1)&&(last[j]==last[j+1])){
                num++;
            }
            else{
                now.append(to_string(num)+last[j]);
                num=1;
            }
        }
    }
    return now;
}
int main(){
    string result = countAndSay(5);
    cout<<result;
    return 0;
}